package com.xydtech.busiflw.controller;

import com.xydtech.busiflw.domain.BusiflDocList;
import com.xydtech.busiflw.service.IBusiflDocListService;
import com.xydtech.common.annotation.Log;
import com.xydtech.common.core.controller.BaseController;
import com.xydtech.common.core.domain.AjaxResult;
import com.xydtech.common.core.page.TableDataInfo;
import com.xydtech.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 业务流程影像上传明细Controller
 *
 * @author xydtech
 * @date 2022-01-05
 */
@Controller
@RequestMapping("/busiflw/docList")
public class BusiflDocListController extends BaseController {
    private String prefix = "busiflw/docList";

    @Autowired
    private IBusiflDocListService busiflDocListService;

    @GetMapping("/{docRegId}")
    public String docList(@PathVariable("docRegId") Long docRegId, ModelMap mmap) {
        mmap.put("docRegId", docRegId);
        return prefix + "/docList";
    }

    /**
     * 查询业务流程影像上传明细列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(BusiflDocList busiflDocList) {
        startPage();
        List<BusiflDocList> list = busiflDocListService.selectBusiflDocListList(busiflDocList);
        return getDataTable(list);
    }

    /**
     * 删除业务流程影像上传明细
     */
    @Log(title = "删除业务流程影像上传明细", businessType = BusinessType.DELETE)
    @PostMapping("/delete")
    @ResponseBody
    public AjaxResult remove(Long id, Long docRegId) {
        return toAjax(busiflDocListService.deleteBusiflDocListById(id, docRegId));
    }
}
